package service;

import java.util.List;

import models.Ordcom;
import models.Orwrba;

public class OrdcomService {
	
	public static List<Ordcom> findAll(Long id){
		List<Ordcom> ordcomlist = Ordcom.find("from Ordcom where indid=?",id.toString()).fetch();
		return ordcomlist;
	}
	
	public static Ordcom onlyone(Long id){
		Ordcom ordcom = Ordcom.findById(id);
		return ordcom;
	}
	
	public static List<Orwrba> findAllorw(String orid){
		System.out.println(orid+"---------------------------");
		List<Orwrba> orwrbalist = Orwrba.find("from Orwrba where ordid = ?", orid).fetch();
		return orwrbalist;
	}
	
	public static int delord(String id){
		int  result = Ordcom.delete("from Ordcom where id = ?", Long.parseLong(id));
		return result;
	}
	
	public static int delowr(String id){
		int result = Orwrba.delete("from Orwrba where id = ?", Long.parseLong(id));
		return result ;
	}
}
